In 1673, after continued looting of Panama City by pirates, the Spanish inhabitants fled and resettled further west (where today's Panama City now stands). They rebuilt the city, amid swamps, disease and a failing economy -[L3 202 / the Spanish Empire was beginning to fade into obscurity]. Only half a century later, the Spanish government annexed Panama to the Viceroyalty of Granada, eliminating its autonomy and sparking off a liberation struggle that would continue in one way or another right through to the end of the 20th century.